package com.jsu.clubmanagementsystem.common;

public class ResultUtils {
    public static <T> BaseResponse<T> success(T data){
        return new BaseResponse<T>(data, 0, "OK");
    }

    public static BaseResponse error(ErrorCode errorCode){
        return new BaseResponse<>(null, errorCode.getCode(), errorCode.getMessage());
    }

    public static BaseResponse error(int code, String message){
        return new BaseResponse<>(null, code, message);
    }

    public static BaseResponse error(ErrorCode errorCode, String message){
        return new BaseResponse<>(null, errorCode.getCode(), message);
    }
}
